Skip to main content

Jobs Sync Workflow

The Jobs Sync Workflow ensures that Bookadoc remains synchronized with AthenaHealth by periodically fetching:

  1. Open Appointment Slots – Available slots that patients can book is scheduled to run once at the beginning of the day (UTC).
  2. Booked Appointments – Appointments that have already been booked is scheduled to run every 10mins.

By keeping Bookadoc updated with real-time availability, this integration prevents double bookings and ensures providers' schedules remain accurate.


1. Syncing Open Appointment Slots

Bookadoc retrieves open appointment slots from AthenaHealth to display available times for patients.

Process Flow

  1. Bookadoc triggers a scheduled job at regular intervals.
  2. The system sends a request to AthenaHealth to fetch available appointment slots.
  3. The response is processed and stored in Bookadoc’s database.
  4. Patients can only book from the available slots.

API Endpoint

GET /v1/{practiceid}/appointments/open

Example Request

GET /v1/12345/appointments/open

Response Example

[
{
"appointmentid": "1861676",
"appointmentstatus": "o",
"providerid": "27",
"departmentid": "150",
"date": "02/07/2025",
"starttime": "08:00",
"duration": 15
}
]

Processing the Response

  • Bookadoc extracts appointment slots where appointmentstatus = "o" (open).
  • The data is stored in the local database and made available for patients to book.
  • If no slots are available, the system prevents new bookings.

2. Syncing Booked Appointments

Bookadoc fetches booked appointments to ensure that all scheduling data matches AthenaHealth.

Process Flow

  1. Bookadoc triggers a scheduled job to retrieve all booked appointments.
  2. The system sends a request to AthenaHealth to fetch appointments that are no longer available for booking.
  3. The response is compared with Bookadoc’s database.
  4. Any mismatches are updated to keep records in sync.

API Endpoint

GET /v1/{practiceid}/appointments/booked

Example Request

GET /v1/12345/appointments/booked

Response Example

[
{
"appointmentid": "1861676",
"appointmentstatus": "f",
"providerid": "27",
"departmentid": "150",
"date": "02/07/2025",
"starttime": "08:00",
"duration": 15
}
]

Processing the Response

  • Bookadoc identifies booked appointments where appointmentstatus = "f" (filled).
  • These slots are marked as unavailable in Bookadoc’s system.
  • If a patient attempts to book a slot that has already been taken, an error is shown.

3. Managing Appointment Slot Changes

Bookadoc subscribes to appointment slot changes in AthenaHealth, allowing real-time updates when appointments are modified.

API Endpoint

POST /v1/{practiceid}/appointments/subscribe

Example Request

{
"event": "appointment_slot_change",
"callback_url": "https://bookadoc.com/api/athena/appointment-updates"
}

Real-time Updates Process

  1. AthenaHealth sends a notification to Bookadoc when an appointment slot is booked, rescheduled, or canceled.
  2. Bookadoc updates its database accordingly.
  3. Patients and providers receive real-time updates about scheduling changes.

Error Handling

The Jobs Sync Workflow must handle errors efficiently to ensure data integrity.

Common Errors & Resolutions

Error CodeDescriptionResolution
400 Bad RequestInvalid request parametersValidate request before sending
401 UnauthorizedInvalid credentialsEnsure authentication token is valid
500 Internal Server ErrorAthenaHealth service issueImplement retries and log errors

Conclusion

The Jobs Sync Workflow ensures that Bookadoc maintains an up-to-date appointment schedule by syncing open slots, booked appointments, and handling real-time slot changes. This synchronization prevents conflicts and enhances the efficiency of scheduling for healthcare providers and patients.